{include file="header.html"}
<script type="text/javascript" charset="utf-8" src="../htmleditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../htmleditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="../htmleditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="templates/js/jquery.colorbox.js" charset="utf-8"></script>
<link href="templates/style/colorbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function(){
    $('#article_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('right').text('OK!');
        },
        rules : {    
            title : {
                required : true
            },
            cate_id :{
                required : true
            },
            link    :{
                url     : true
            },
            sort_order:{
               number   : true
            },
            file_url : {
                accept  : 'gif|png|jpe?g'
            }
        },
        messages : {
            title : {
                required : '{$lang.title_empty}'
            },
            cate_id : {
                required : '{$lang.cate_empty}'
            },
            link    : {
                url     : '{$lang.link_limit}'
            },
            file_url : {
                accept : '{$lang.limit_img}'
            },
            sort_order  : {
                number   : '{$lang.number_only}'
            }
        }
    });
 
    $('#type').change(function(){
    	var tp=$(this).children('option:selected').val();
    	if(tp=='url'){
    		$("#xuanz").css("display","none");
    		$("#qingchu").css("display","none");	
    	}else{
    		$("#xuanz").css("display","");
    		$("#qingchu").css("display","");
    	}
    	del_type();
    });
    
});

function sel_type(id){
    $w=$(window).width();
    $h=$(window).height();
    $w=$w*0.7;
    $("#tagframe").width($w);
    type=$("#type").val();  
    url=$("#url").val();
    if(type!=0){
	$("#tagframe").attr("src","index.php?app=ad&act=sel_type&id="+id+"&type="+type);
    $.colorbox({
        width : $w+20,
        height : "650px",
        inline : true,
        href : "#taglist"
    });
    }else{
    	
    	alert('请选择分类');
    }

}

function del_type(){ 
	  $("#outkey").val("");//清空  
	  $("#tname").val("");//清空  
}
</script>
 
<div id="rightTop">
    <p>活动</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=ad">{$lang.manage}</a></li>
        {if $activity.ad_tid}
        <li><span>{$lang.edit}</span></li>
        {else}
        <li><span>{$lang.add}</span></li>
        {/if}
    </ul>
</div>
<div style="display: none"  >
	<div id="taglist">
	<iframe id="tagframe"   width="800px" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>
<div class="info">
    <form method="post" enctype="multipart/form-data" id="article_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    {$lang.title}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="title" type="text" name="title" value="{$activity.title|escape}" />
                </td>
            </tr> 
            
             <tr>
                <th class="paddingT15">外链  :</th>
                <td class="paddingT15 wordSpacing5">
                 <input class="infoTableInput2" id="url" type="text" name="url" value="{$activity.url|escape}" />
                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.page}:</th>
                <td class="paddingT15 wordSpacing5">
                     <select id="page" name="page" style="width: 312px;">
                    <option value="">请选择</option>
                    {html_options options=$dis_page selected=$activity.page}
                    </select>
                </td>
            </tr>
             <tr>
                <th class="paddingT15">
                    {$lang.position}:</th>
                <td class="paddingT15 wordSpacing5">
                     <select id="position" name="position" style="width: 312px;">
                    <option value="">请选择</option>
                    {html_options options=$dis_position selected=$activity.position}
                    </select>
                </td>
            </tr>
             <tr>
                <th class="paddingT15">
                    图片:</th>
                <td class="paddingT15 wordSpacing5">
                {if $activity.pic}
                 <a href="/{$activity.pic}" target="_blank"><img src="/{$activity.pic}" class="makesmall" max_width="120" max_height="90" /></a>
                {/if}
                    <input class="infoTableFile2" id="pic" type="file" name="pic" />
                    {$lang.limit_img}
                </td>
            </tr>

            <tr>
                <th class="paddingT15">
                    {$lang.content}:</th>
                <td class="paddingT15 wordSpacing5">                
                    <textarea id="article_content" name="article_content" style="width:650px;height:400px;">{$activity.content|escape}</textarea>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('article_content');
</script>
                </td>
            </tr>
             
               <tr>
                <th class="paddingT15">
                    {$lang.is_show}:</th>
                <td class="paddingT15 wordSpacing5">                             
                     <input name="is_show" type="checkbox" id="is_show" value="1" {if $activity.is_show}checked{/if} />
                </td>
               </tr>
               
               <tr>
                <th class="paddingT15">
                    {$lang.sort_order}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$activity.sort_order}" />
                </td>
            </tr>
            
        <tr>
            <th></th>
            <td class="ptb20">
                <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                <input class="formbtn" type="reset" name="Submit2" value="{$lang.reset}" />
            </td>
        </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
